import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

let Home = resolve => require(['../components/ContentView'], resolve)
export default new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: [
    // 登陆
    {
      path: '/login',
      name: 'login',
      hidden: true,
      component: resolve => require(['../components/LoginView.vue'], resolve)
    },
    // 注册
    {
      path: '/register',
      name: 'register',
      hidden: true,
      component: resolve => require(['../components/RouterView/Register/Register.vue'], resolve)
    },
    // 密码
    {
      path: '/password',
      name: 'password',
      hidden: true,
      component: resolve => require(['../components/RouterView/Password/Password.vue'], resolve)
    },
    // 根页面
    {
      path: '/',
      component: Home,
      hidden: true,
      redirect: '/PersonnelManagement/PersonnelManagementPage'
    },
    {
      meta: '人员管理',
      name: 'Personnel',
      path: '/Personnel',
      component: Home,
      icon: 'icon-renyuanguanli',
      redirect: '/PersonnelManagement/PersonnelManagementPage',
      children: [
        {
          meta: '人员列表',
          name: 'PersonnelManagement',
          path: '/PersonnelManagement/PersonnelManagementPage',
          component: resolve => require(['../components/RouterView/PersonnelManagement/PersonnelManagement.vue'], resolve)
        },
        {
          meta: '角色列表',
          name: 'RoleManagement',
          path: '/PersonnelManagement/RoleManagementPage',
          component: resolve => require(['../components/RouterView/PersonnelManagement/RoleManagement.vue'], resolve)
        },
        {
          meta: '权限列表',
          name: 'PowerManagement',
          path: '/PersonnelManagement/PowerManagementPage',
          component: resolve => require(['../components/RouterView/PersonnelManagement/PowerManagement.vue'], resolve)
        }
      ]
    },
    {
      meta: '设备管理',
      name: 'Device',
      path: '/Device',
      component: Home,
      icon: 'icon-shebeiguanli',
      redirect: '/DeviceManagement/DeviceManagementPage',
      children: [
        {
          meta: '设备管理',
          name: 'DeviceManagement',
          path: '/DeviceManagement/DeviceManagementPage',
          component: resolve => require(['../components/RouterView/DeviceManagement/DeviceManagement.vue'], resolve)
        }
      ]
    },
    {
      meta: '日志管理',
      name: 'Log',
      path: '/Log',
      component: Home,
      icon: 'icon-rizhiguanli',
      redirect: '/MemberLogManagement/MemberLogManagementPage',
      children: [
        {
          meta: '会员日志',
          name: 'MemberLogManagement',
          path: '/MemberLogManagement/MemberLogManagementPage',
          component: resolve => require(['../components/RouterView/LogManagement/MemberLogManagement.vue'], resolve)
        },
        {
          meta: '详情日志',
          name: 'DetailsLogManagement',
          path: '/DetailsLogManagement/DetailsLogManagementPage',
          component: resolve => require(['../components/RouterView/LogManagement/DetailsLogManagement.vue'], resolve)
        },
        {
          meta: '服务器日志',
          name: 'ServerLogManagement',
          path: '/ServerLogManagement/ServerLogManagementPage',
          component: resolve => require(['../components/RouterView/LogManagement/ServerLogManagement.vue'], resolve)
        }
      ]
    },
    {
      meta: '资产管理',
      name: 'Assets',
      path: '/Assets',
      component: Home,
      icon: 'icon-zichanguanli',
      redirect: '/AssetsManagement/AssetsManagementPage',
      children: [
        {
          meta: '资产管理',
          name: 'AssetsManagement',
          path: '/AssetsManagement/AssetsManagementPage',
          component: resolve => require(['../components/RouterView/AssetsManagement/AssetsManagement.vue'], resolve)
        }
      ]
    },
    {
      meta: '工单管理',
      name: 'Order',
      path: '/Order',
      component: Home,
      icon: 'icon-gongdanguanli',
      redirect: '/OrderManagement/OrderManagementPage',
      children: [
        {
          meta: '工单管理',
          name: 'OrderManagement',
          path: '/OrderManagement/OrderManagementPage',
          component: resolve => require(['../components/RouterView/OrderManagement/OrderManagement.vue'], resolve)
        }
      ]
    },
    {
      meta: '上传测试',
      name: 'Upload',
      path: '/Upload',
      component: Home,
      redirect: '/UploadManagement/UploadManagementPage',
      children: [
        {
          meta: '上传测试',
          name: 'UploadManagement',
          path: '/UploadManagement/UploadManagementPage',
          component: resolve => require(['../components/RouterView/Upload/Upload.vue'], resolve)
        }
      ]
    },
    {
      meta: '视频测试',
      name: 'Movie',
      path: '/Movie',
      component: Home,
      redirect: '/MovieManagement/MovieManagementPage',
      children: [
        {
          meta: '视频测试',
          name: 'MovieManagement',
          path: '/MovieManagement/MovieManagementPage',
          component: resolve => require(['../components/RouterView/Movie/Movie.vue'], resolve)
        }
      ]
    },
    {
      meta: 'GIS',
      name: 'GIS',
      path: '/GIS',
      component: Home,
      redirect: '/GISManagement/GISManagementPage',
      children: [
        {
          meta: 'GISManagement',
          name: 'GIS',
          path: '/GISManagement/GISManagementPage',
          component: resolve => require(['../components/RouterView/GIS/GISBaiDuMap.vue'], resolve)
        }
      ]
    },
    {
      meta: 'Chatrs',
      name: 'Chatrs',
      path: '/Chatrs',
      component: Home,
      redirect: '/ChatrsManagement/ChatrsManagementPage',
      children: [
        {
          meta: 'ChatrsManagement',
          name: 'Chatrs',
          path: '/ChatrsManagement/ChatrsManagementPage',
          component: resolve => require(['../components/RouterView/Chart/Echarts.vue'], resolve)
        }
      ]
    },
    {
      meta: 'LED',
      name: 'LED',
      path: '/LED',
      component: Home,
      redirect: '/LEDManagement/LEDManagementPage',
      children: [
        {
          meta: 'LEDManagement',
          name: 'LED',
          path: '/LEDManagement/LEDManagementPage',
          component: resolve => require(['../components/RouterView/LED/LEDState.vue'], resolve)
        }
      ]
    }
  ]
})
